package com.alipay.gradledemo;

import android.app.AppComponentFactory;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

/**
 * @name： GradleDemo
 * @author： lion
 * @time： 2023/6/13 13:30
 * @version： 1.0
 * @description：
 */
public class Demo extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //build.gradle 中定义的变量
        setContentView( R.layout.activity_main);
        ApplicationInfo appInfo;
        try {
            appInfo = this.getPackageManager().getApplicationInfo(this.getPackageName(), PackageManager.GET_META_DATA);
            Bundle bundle = appInfo.metaData;
            String app_channel = bundle.getString("CHANNEL_NAME", null);
            Toast.makeText(getApplicationContext(), app_channel, Toast.LENGTH_SHORT).show();
        } catch (Exception e) {
            e.printStackTrace();
        }
        findViewById(R.id.bt_download).setOnClickListener( v->{
            NetworkSpeedTest.startDownLoadSpeed();
        });
        findViewById(R.id.bt_upload).setOnClickListener( v->{

            NetworkSpeedTest.startUploadSpeed();
        });



    }
}
